export const serverUrl = "http://localhost:3000";

// 上传图片的接口地址
export const uploadUrl = serverUrl + "/api/v1/common/upload_file";

/**
 * 处理图片
 * @param img
 * @returns
 */
export const dalImg = (img: string) => {
  if (img) {
    if (img.startsWith("http")) return img;
    return serverUrl + img;
  }
  return "https://img0.baidu.com/it/u=3490662213,3968247924&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=720";
};

/**
 * 设置token
 * @param token
 * @returns
 */
export const setToken = (token: string) =>
  sessionStorage.setItem("token", token);

/**
 *
 * @returns 获取token
 */
export const getToken = () => sessionStorage.getItem("token");

/**
 * 删除token
 * @returns
 */
export const removeToken = () => sessionStorage.removeItem("token");
